HA$PBExportHeader$u_cst_m_cabedetamain.sru
forward
global type u_cst_m_cabedetamain from userobject
end type
type dw_2 from datawindow within u_cst_m_cabedetamain
end type
type dw_1 from datawindow within u_cst_m_cabedetamain
end type
end forward

global type u_cst_m_cabedetamain from userobject
integer width = 2752
integer height = 2940
long backcolor = 67108864
string text = "none"
long tabtextcolor = 33554432
long picturemaskcolor = 536870912
event resize pbm_size
event ue_grabar ( )
event type integer ue_cancelar ( )
event ue_enter pbm_dwnprocessenter
event ue_preview ( )
event ue_consultar ( long al_id )
event ue_editar ( powerobject ap_object )
event ue_nuevo ( powerobject ap_object )
dw_2 dw_2
dw_1 dw_1
end type
global u_cst_m_cabedetamain u_cst_m_cabedetamain

type variables
s_parm istr_parm
boolean dw_has_focus
string is_error ,is_tool
long il_id
datastore ids_datastore

u_cst_powerdock uo_powerdock
end variables

event resize;//uo_toolbarstrip.Width =(this.width - 12) 
DW_1.Resize(Width, NEWHeight / 2 )
DW_2.Resize(Width, NEWHeight / 2 )
//uo_1.Resize(NewWidth - 10, NewHeight - uo_1.Y - 15)
end event

event ue_grabar();integer li_return=1
//dw_1.accepttext( )
if dw_1.accepttext( ) = -1 Then Return // -1

//If f_findrequired(dw_1) = -1 Then Return -1

dw_1.update()
commit;
f_msj('OK',4)

uo_powerdock.of_closedocument( uo_powerdock.of_getactiveobject( ))
//this.of_closedocument( this.of_getactiveobject( ))
//return li_return
end event

event type integer ue_cancelar();

if f_msj('esta seguro que desea cancelar',2) =2 then 
	return -1   //aqui no se cierra
else
	return 1 
end if
end event

event ue_enter;Send( Handle( this ), 256, 9, Long( 0, 0 ) ) // Send message for processing TAB key 
return 1 
end event

event ue_preview();dw_1.modify('datawindow.print.Preview=yes')
end event

event ue_consultar(long al_id);string ls
dw_1.reset()
dw_1.retrieve(al_id)
commit;

end event

event ue_editar(powerobject ap_object);//string ls_dw,ls_user
//
//istr_parm = ap_object
//uo_powerdock = istr_parm.power_param
//ids_datastore =  istr_parm.ds_param[1]
//ls_dw = ids_datastore.object.cDwMain2[1]
//il_id                  = istr_parm.l_param[1]
//is_tool               = istr_parm.s_param[1]
//dw_1.reset()
//dw_1.retrieve( il_id)
//commit;
//ls_user = dw_1.object.clogin[1]
//uo_powerdock.of_setdocumenttext( this,ls_user)
end event

event ue_nuevo(powerobject ap_object);string ls_dw,ls_user

//istr_parm = ap_object
//uo_powerdock = istr_parm.power_param
//ids_datastore =  istr_parm.ds_param[1]
//ls_dw = ids_datastore.object.cDwMain2[1]
//il_id                  = istr_parm.l_param[1]
//is_tool               = istr_parm.s_param[1]
//dw_1.reset()
//dw_1.insertrow( 0)
//commit;
//
end event

on u_cst_m_cabedetamain.create
this.dw_2=create dw_2
this.dw_1=create dw_1
this.Control[]={this.dw_2,&
this.dw_1}
end on

on u_cst_m_cabedetamain.destroy
destroy(this.dw_2)
destroy(this.dw_1)
end on

event constructor;string ls_dw3,ls_dw2,ls_opc,ls_dw,ls_user
long ll_codigo
//istruc_param_dw = message.powerobjectparm

istr_parm       = message.powerobjectparm
ids_datastore  = istr_parm.ads_menu
ls_dw            = ids_datastore.object.cUcstMantoCabeDetaDw1[1]
ls_dw2           = ids_datastore.object.cUcstMantoCabeDetaDw2[1]
uo_powerdock = istr_parm.auo_powerdock
 
//il_id                  = istr_parm.l_param[1]
//is_tool               = istr_parm.s_param[1]

dw_1.dataobject=ls_dw
dw_2.dataobject=ls_dw2
dw_1.settransobject(sqlca) ; dw_2.settransobject(sqlca)
dw_1.insertrow( il_id)



end event

type dw_2 from datawindow within u_cst_m_cabedetamain
integer y = 1068
integer width = 2734
integer height = 1852
integer taborder = 20
string title = "none"
boolean livescroll = true
borderstyle borderstyle = stylelowered!
end type

type dw_1 from datawindow within u_cst_m_cabedetamain
event ue_accepttext ( )
event ue_enter pbm_dwnprocessenter
integer width = 2738
integer height = 1064
integer taborder = 10
string title = "none"
string dataobject = "d_cab_proforma"
boolean livescroll = true
borderstyle borderstyle = stylelowered!
end type

event ue_accepttext();//IF dw_has_focus = false THEN
//
//        dw_1.accepttext( )
//
//END IF
end event

event ue_enter;Send( Handle( this ), 256, 9, Long( 0, 0 ) ) // Send message for processing TAB key 
return 1 
end event

event itemerror;Choose Case dwo.name
	Case 'idproforma'
		
//	      MessageBox('Advertencia',is_error,Stopsign!)
	Case 'cc_locac','cc_almac','ci_tipart'
//		MessageBox('Advertencia',is_error,stopsign!)
	Case 'cc_docum','cn_docum'
//		MessageBox('Advertencia',is_error,stopsign!)
End Choose

Return 1
end event

event getfocus;//dw_has_focus = true
end event

event losefocus;//dw_has_focus = false
//
//dw_1.event  post ue_acceptText( )
end event

event itemchanged;//Choose Case dwo.name
//	Case 'idproforma'
//		If Trim(data) = '' Or IsNull(data) Then
//			is_error = 'Error, Digite un C$$HEX1$$f300$$ENDHEX$$digo Valido'
//			Return 1
//		End If
//end choose 
end event

